<template>
  <el-dialog v-model="dialogTableVisible" title="申请详情" destroy-on-close width="70%" v-loading="loading">

    <el-scrollbar max-height="600px" style="border: 2px solid lightblue">
      <ClaimApply v-if="applyItem.type==='claim'" :apply-item="applyItem"></ClaimApply>
      <AddApply v-else-if="applyItem.type==='add'" :apply-item="applyItem"></AddApply>
      <UpdateApply v-else-if="applyItem.type==='update'" :apply-item="applyItem"></UpdateApply>
      <DeleteApply v-else-if="applyItem.type==='delete'" :apply-item="applyItem"></DeleteApply>
    </el-scrollbar>
  </el-dialog>
</template>

<script>
import ClaimApply from "./apply/ClaimApply";
import AddApply from "./apply/AddApply";
import UpdateApply from "./apply/UpdateApply";
import DeleteApply from "./apply/DeleteApply";
import axios from "../../utils/MyAxios";
import qs from "qs";
import {ElMessage} from "element-plus";

export default {
  name: "ApplyInfo",
  data(){
    return{
      dialogTableVisible:false,
      applyItem: null,
      loading: true
    }
  },
  methods:{
    openInfo(applyId){
      let data = {
        applyId
      }
      axios.post('/api/apply/info',qs.stringify(data))
          .then(res=>{
            console.log(res);
            data = res.data;
            if(data.code!==0){
              ElMessage.error(data.msg);
            }else{
              this.applyItem = data.data;
              this.dialogTableVisible = true;
              this.loading = false;
            }
          })

    }
  },
  components:{
    ClaimApply,
    AddApply,
    UpdateApply,
    DeleteApply
  },
}
</script>

<style scoped>

</style>